﻿#ifndef TURNTABLECODEBASE_H
#define TURNTABLECODEBASE_H

#include <qobject.h>
#include <qdebug.h>

class TurnTableCodeBase
{
public:
  explicit TurnTableCodeBase(){}
  virtual ~TurnTableCodeBase(){}
public:
  virtual QByteArray code(float arg1,float arg2,float arg3)
  {
    (void)arg1;
    (void)arg2;
    (void)arg3;
    return QByteArray();
  }
protected:
  QByteArray intToByteArray(int const arg)
  {
    return QByteArray((char*)(&arg),4);
  }

  QByteArray floatToByteArray(float const arg)
  {
    int temp=arg*100000;
    return QByteArray((char*)(&temp),4);
  }

  QByteArray& addSummnation(QByteArray& data)
  {
    int len = 15;
    uchar total = 0x00;
    for (int i = 0; i < len; i++) {
        total += (uchar)data.at(i);
      }
     data[15] = (~total)+1;
    return data;
  }
};

#endif // TURNTABLECODEBASE_H
